package com.zhuiyun.project.api.plan.fitnessSeries.controller;

import com.zhuiyun.project.annotation.OptLog;
import com.zhuiyun.project.api.plan.fitnessPlan.entity.FitnessPlan;
import com.zhuiyun.project.api.plan.fitnessPlan.mapper.FitnessPlanMapper;
import com.zhuiyun.project.api.plan.fitnessPlan.service.FitnessPlanService;
import com.zhuiyun.project.api.plan.fitnessSeries.entity.FitnessPurpose;
import com.zhuiyun.project.api.plan.fitnessSeries.entity.FitnessSeries;
import com.zhuiyun.project.api.plan.fitnessSeries.model.FitnessPurposeModel;
import com.zhuiyun.project.api.plan.fitnessSeries.model.FitnessSeriesModel;
import com.zhuiyun.project.api.plan.fitnessSeries.service.FitnessSeriesService;
import com.zhuiyun.project.common.errorCode.CommonException;
import com.zhuiyun.project.common.response.CommonResult;
import com.zhuiyun.project.utils.constants.CommonConstants;
import com.zhuiyun.project.utils.pageUtil.PageRequest;
import com.zhuiyun.project.utils.pageUtil.PageResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ClassName FitnessActionController
 * @Description TODO
 * @Author ys
 * @Date 2023/11/2 8:48
 **/
@RestController
@RequestMapping("/plan")
public class FitnessSeriesController {
    @Autowired
    private FitnessSeriesService fitnessSeriesService;

    @Resource
    FitnessPlanMapper fitnessPlanMapper;
    /**
    * @Author 杨珅
    * @Description todo 健身系列分页查询
    * @Date 2023/11/2 9:28
    * @Return  * @param null
    */
    @PreAuthorize("@ss.hasPermi('plan:fitnessPlan')")
    @ApiOperation(value = "健身计划分页查询")
    @OptLog(modular = "健身计划列表", type = CommonConstants.SELECT, describe = "健身计划分页查询 ")
    @GetMapping("/getFitnessSeries")
    public CommonResult selectAll(PageRequest pageRequest, String seriesName,String venueUniqueIdentifier){
        PageResult pageResult = fitnessSeriesService.selectAll(pageRequest,seriesName,venueUniqueIdentifier);
        return CommonResult.ok(pageResult);
    }
    /**
     * @Author 杨珅
     * @Description todo 健身系列分页查询
     * @Date 2023/11/2 9:28
     * @Return  * @param null
     */
    @PreAuthorize("@ss.hasPermi('plan:fitnessPlan')")
    @ApiOperation(value = "健身计划分页查询")
    @OptLog(modular = "健身计划列表", type = CommonConstants.SELECT, describe = "健身计划分页查询 ")
    @GetMapping("/getFitnessCoachSeries")
    public CommonResult selectCoachAll(PageRequest pageRequest, String seriesName,String venueUniqueIdentifier,Integer coachId){
        PageResult pageResult = fitnessSeriesService.selectCoachAll(pageRequest,seriesName,venueUniqueIdentifier,coachId);
        return CommonResult.ok(pageResult);
    }
    /**
     * @Author 杨珅
     * @Description todo 健身系列分页查询
     * @Date 2023/11/2 9:28
     * @Return  * @param null
     */
    @ApiOperation(value = "健身计划分页查询")
    @OptLog(modular = "健身计划列表", type = CommonConstants.SELECT, describe = "健身计划分页查询 ")
    @GetMapping("/getFitnessCoachSeriess")
    public CommonResult selectCoachAlls( String seriesName,String venueUniqueIdentifier,Integer coachId){
        CommonResult commonResult = fitnessSeriesService.selectCoachAlls(seriesName, venueUniqueIdentifier, coachId);
        return CommonResult.ok(commonResult);
    }
//    /**
//     * @Author 杨珅
//     * @Description todo 根据学院id查询计划
//     * @Date 2023/11/2 9:28
//     * @Return  * @param null
//     */
//    @PreAuthorize("@ss.hasPermi('plan:fitnessPlan')")
//    @ApiOperation(value = "健身计划分页查询")
//    @OptLog(modular = "健身计划列表", type = CommonConstants.SELECT, describe = "健身计划分页查询 ")
//    @GetMapping("/selectPlanById")
//    public CommonResult selectPlanById(@RequestParam Integer memberId){
//        return CommonResult.ok(fitnessPlanService.selectPlanById(memberId));
//    }
    /**
     * @Author 杨珅
     * @Description todo 健身系列新增
     * @Date 2023/11/2 9:28
     * @Return  * @param null
     */
    @PreAuthorize("@ss.hasPermi('plan:fitnessPlan')")
    @ApiOperation(value = "健身计划新增")
    @OptLog(modular = "健身计划列表", type = CommonConstants.ADD, describe = "健身计划新增 ")
    @PostMapping("/addFitnessSeries")
    public CommonResult insertFitnessSeries(@RequestBody FitnessSeriesModel fitnessSeriesModel){
        return CommonResult.ok(fitnessSeriesService.insertFitnessSeries(fitnessSeriesModel));
    }
    /**
     * @Author 杨珅
     * @Description todo 健身系列新增
     * @Date 2023/11/2 9:28
     * @Return  * @param null
     */
    @PreAuthorize("@ss.hasPermi('plan:fitnessPlan')")
    @ApiOperation(value = "健身计划新增")
    @OptLog(modular = "健身计划列表", type = CommonConstants.ADD, describe = "健身计划新增 ")
    @PostMapping("/insertFitnessSeriesss")
    public CommonResult insertFitnessSeriesss(@RequestBody FitnessSeriesModel fitnessSeriesModel){
        return CommonResult.ok(fitnessSeriesService.insertFitnessSeriesss(fitnessSeriesModel));
    }
//    /**
//     * @Author 杨珅
//     * @Description todo 健身计划修改
//     * @Date 2023/11/2 9:28
//     * @Return  * @param null
//     */
//    @PreAuthorize("@ss.hasPermi('plan:fitnessPlan')")
//    @ApiOperation(value = "健身计划修改")
//    @OptLog(modular = "健身计划列表", type = CommonConstants.UPDATE, describe = "健身计划修改 ")
//    @PutMapping("/updateFitnessPlan")
//    public CommonResult updateFitnessPlan(@RequestBody FitnessPlan fitnessPlan)throws CommonException{
//        return CommonResult.ok(fitnessPlanService.updateFitnessPlan(fitnessPlan));
//    }
    /**
     * @Author 杨珅
     * @Description todo 健身系列删除
     * @Date 2023/11/2 9:28
     * @Return  * @param null
     */
    @PreAuthorize("@ss.hasPermi('plan:fitnessPlan')")
    @ApiOperation(value = "健身计划删除")
    @OptLog(modular = "健身计划列表", type = CommonConstants.DELETE, describe = "健身计划删除 ")
    @DeleteMapping("/deleteFitnessSeries")
    public CommonResult deleteFitnessSeries(@RequestBody FitnessSeries fitnessSeries){
        return CommonResult.ok(fitnessSeriesService.deleteFitnessSeries(fitnessSeries));
    }

    /**
    * @Author 田
    * @Description 查询健身系列训练部位
    * @Date 2024/3/13 16:34
    * @Return com.zhuiyun.project.common.response.CommonResult
    * @param fitnessPurpose
    */
    @ApiOperation(value = "查询健身系列训练部位")
    @OptLog(modular = "健身系列",type = CommonConstants.SELECT,describe = "查询健身系列训练部位")
    @GetMapping("/selectPurpose")
    public CommonResult selectPurpose(FitnessPurpose fitnessPurpose){
        return CommonResult.ok(fitnessSeriesService.selectPurpose(fitnessPurpose));
    }

    /**
    * @Author fei
    * @Description 添加健身系列目的和动作
    * @Date 2024/3/14 10:52
    * @Return com.zhuiyun.project.common.response.CommonResult
    * @param fitnessPurposeModel
    */
    @ApiOperation(value = "添加健身系列目的和动作")
    @OptLog(modular = "健身系列",type = CommonConstants.SELECT,describe = "添加健身系列目的和动作")
    @PostMapping("/insertPurPoseAction")
    public CommonResult insertPurPoseAction(@RequestBody FitnessPurposeModel fitnessPurposeModel){
        return CommonResult.ok(fitnessSeriesService.insertPurPoseAction(fitnessPurposeModel));
    }

    /*@OptLog(modular = "健身系列训练部位新增", type = CommonConstants.ADD, describe = "健身系列训练部位新增 ")
    @PostMapping("/insertFitnessPurpose")
    public CommonResult insertFitnessPurpose(@RequestBody FitnessSeriesModel fitnessSeriesModel){
        return CommonResult.ok(fitnessSeriesService.insertFitnessPurpose(fitnessSeriesModel));
    }*/

    /*@ApiOperation(value = "健身系列部位新增")
    @OptLog(modular = "健身系列部位", type = CommonConstants.ADD, describe = "健身系列部位新增 ")
    @PostMapping("/insertFitnessPurpose")
    public CommonResult insertFitnessPurpose(@RequestBody FitnessSeriesModel fitnessSeriesModel){
        return CommonResult.ok(fitnessSeriesService.insertFitnessPurpose(fitnessSeriesModel));
    }*/

//
//    /*
//    * @Author xy
//    * @Description todo 测试sql拦截器查询
//    * @Date 2023/11/30 18:48
//    * @Return
//    * @param
//    */
//    @GetMapping("/test")
//    public CommonResult test(){
//        fitnessPlanMapper.selectList(null);
//        return CommonResult.ok();
//    }
}
